

class Item:

    def __init__(self):
        self.stamina = 0
        self.strength = 0
        self.intelligence = 0
        self.agility = 0
        self.armor = 0
        self.type = None
    
    def setType(self, type):
        self.type = type
        
    def set(self, sta, inte, stre, agil, armo):
        self.stamina = sta
        self.intelligence = inte
        self.strength = stre
        self.agility = agil
        self.armor = armo
        
    def readFromPSO(self, pso):
        self.stamina = pso.get("stamina")
        self.intelligence = pso.get("intelligence")
        self.strength = pso.get("strength")
        self.agility = pso.get("agility")
        self.armor = pso.get("armor")
        self.type = pso.type
        
    @staticmethod
    def loadFromPSO(pso):
        item = Item()
        item.readFromPSO(pso)
        return item
    
    def writeToPSO(self, pso):
        pso.set("stamina", self.stamina)
        pso.set("intelligence", self.intelligence)
        pso.set("strength", self.strength)
        pso.set("agility", self.agility)
        pso.set("armor", self.armor)
        pso.type = self.type
        
